Fix cross compilation of LLVM-3.9#25218
Conversation
It's now possible to cross compile llvm:
`nix-build -E '(import ./. { crossSystem = import ./platform.nix; }).pkgs.llvm'`
|
@expipiplus1, thanks for your PR! By analyzing the history of the files in this pull request, we identified @gebner, @vcunat and @copumpkin to be potential reviewers. |
|
|
||
| buildInputs = [ perl groff cmake libxml2 python libffi ] | ||
| buildInputs = [ | ||
| buildPackages.perl |
There was a problem hiding this comment.
Can these be nativeBuildInputs? might not even cause rebuild for native due to some normalizing in stdenv.
| ''; | ||
|
|
||
| buildInputs = [ cmake libedit libxml2 llvm python ]; | ||
| buildInputs = [ buildPackages.cmake libedit libxml2 llvm python ]; |
There was a problem hiding this comment.
cmake should also be a nativeBuildInput. Note that buildPackages. is not necessary in this case because mkDerivation will magically fish it out.
| "-DLLVM_ENABLE_LIBCXX=ON" | ||
| "-DCAN_TARGET_i386=false" | ||
| ] ++ stdenv.lib.optionals (buildPlatform != hostPlatform) [ | ||
| "-DCMAKE_CROSSCOMPILING=True" |
There was a problem hiding this comment.
Hmm, this is a general cmake thing? This could be generalized to be so added for all derivations with cmakeFlags I suppose.
There was a problem hiding this comment.
This error was cause by multiple-outputs.sh not setting NIX_CROSS_LDFLAGS
| buildInputs = [ | ||
| groff | ||
| libxml2 | ||
| libffi ] |
There was a problem hiding this comment.
Not to be a big nit, but ] on the line below before ++ I think would be more idiomatic.
The current cc-wrapper script seems to have trouble setting the rpath correctly. Hopefully NixOS#25047 will fix this.
|
@expipiplus1 do you consider this ready to merge? Given LLVM 3.9 is what Mesa currently uses, I would target this to |
|
It's not entirely clear to me this is/need-be a hash-breaking change given the way *inputs are normalized. It does look good to me, so definitely want to merge somewhere. |
|
I think the order of inputs needs to change (because the current situation means interleaving of native and target inputs), and that's a hash change. |
|
@7c6f434c Yeah, I think it's good to go. I'd like to get to the bottom of why the shared library support doesn't work at some time. |
|
I'm in no hurry though! |
|
Well, I guess when you want it merged you want to retarget it to the |
|
done! |
Although LLVM now cross compiles successfully the executable do not run, the
RUNPATHof the resultant executables in incorrect, it does not contain theLLVM lib output.